function [p q] = TimeDiscretizers(dt,option)
% Following Algorithms are implemented in the current study
% 1. Fully Implicit Theta Scheme
% 2. Fully Implicit BDF Two parameter Scheme
% 3. Explicit Leap Frog Scheme
% 4. Semi Implicit BDF - By adjusting parameters = Semi Implicit
% Trapezoidal
% 5. Semi Implicit Trapezoidal with Upwinding Discretization
% 6. Semi Implicit Trapezoidal with Central Discretization
% 7. Fully Implicit with Upwinding
global U  h  g  p  q  nt dx h1 x p_global tmax Length L;

%Reinitialize the variables
pi1=1;
qi=1;

for i=1:x
 %       p(i,1) = 0.25*pi1*cos(4*pi*(i-1)*dx/L) + 0.25*pi1 *cos(8*pi*(i-1)*dx/L)  + 0.25*pi1*cos(16*pi*(i-1)*dx/L)+0.25*pi1*cos(32*pi*(i-1)*dx/L)  ;
 
    p(i,1) = pi1*cos(4*pi*(i-1)*dx/Length);
    q(i,1) = qi;
end

p_global = zeros(x,floor(tmax/5));
nt = round(tmax/dt);   % number of time steps
xplot=1:x;
h1 = plot(xplot,p,'yDataSource','p');
p_global(:,1) = p;


if (option ==1)
    %  disp('1. Fully Implicit Theta Scheme\n');
    beta=0.5;
    dx1=1/dx;
    dx2 = 1/(dx*dx);
    %---- Construct the spatial Discretization Matrix------%
    A = zeros(x,x);
    rhs = zeros(2*x,1);
    sol=rhs;
    %A(1,1) = 1/dt;
    A(1,x) = -U*0.5*dx1;
    A(1,2) =  U*0.5*dx1;
    for k=2:x-1
        A(k,k-1) = -U*0.5*dx1;
        A(k,k+1) =  U*0.5*dx1;
    end
    
    A(x,x-1) = -U*0.5*(1/dx);
    A(x,1)   =  U*0.5*(1/dx);
    
    L=zeros(2*x,2*x);
    L(x+1:2*x,x+1:2*x)=A;
    L(1:x,1:x)=A;
    
    L(1,2*x)   = h*dx2;
    L(1,x+2)   = h*dx2;
    L(x,x+1)   = h*dx2;
    L(x,2*x-1) = h*dx2;
    for k=1:x
        L(k,x+k)= -2*h*dx2;
        L(x+k,k)=g;
    end
    
    for k=2:x-1
        L(k,x+k-1) = h*dx2;
        L(k,x+k+1)= h*dx2;
    end
    [p q] = implicit_theta(dt,beta);
    
elseif (option==2)
    disp('2. Fully Implicit BDF Two parameter Scheme \n');
    [p q] = BDF2(dt);
    
elseif (option ==3)
    disp('3. Explicit Leap Frog \n');
    [p q] = leapfrog(dt);
elseif (option==4)
    display(' Semi Implicit Scheme BDF ');
    beta = input('Enter the value of theta:\n');
    alpha = input('Enter the value of  alpha\n');
    [p q] = SemiImplicit_BDF(alpha,beta);
    
elseif (option ==5)
    display(' Semi Implicit Scheme Trapezoidal with upwinding Discretization ');
    [p q] = SemiImplicit_Trapezoidal_Upwinding(dt);
    
elseif (option ==6)
    display(' Semi Implicit Scheme Trapezoidal ');
    [p q] = SemiImplicit_Trapezoidal(dt);
elseif (option ==7)
    display(' Implicit Scheme  Two Parameter Model, Upwinding');
    [p q] = BDF2_Upwinding(dt);
    
end




